package com.jiang.books.mvc;

import com.jiang.books.service.IProfileService;
import org.springframework.stereotype.Controller;
import javax.inject.Inject;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
public class HomeController {
    public static final int DEFFAULT_PROFILES_PER_PAGE = 25;
    private IProfileService profileServiceservice;

    @Inject
    public HomeController (IProfileService profileServiceservice) {
        this.profileServiceservice = profileServiceservice;
    }

    @RequestMapping({"/profiles_view", "/profiles"})
    public String showHomePage(Map<String, Object> model) {
        model.put("profiles", profileServiceservice.findAll());
        return "profiles_view";
    }
}


